# Maintainer: Dylan Van Assche <me@dylanvanassche.be>
# Contributor: Dylan Van Assche <me@dylanvanassche.be>

pkgname=obex-capabilities
pkgver=0.2.1
pkgrel=1
pkgdesc="Script to generate Bluetooth OBEX capabilities XML files at runtime"
url="https://gitlab.com/postmarketOS/obex-capabilities"
arch="noarch"
license="GPL-3.0-or-later"
depends="python3 py3-dbus"
makedepends="py3-setuptools"
checkdepends="py3-pytest"
subpackages="$pkgname-bluez-obexd:_obexd"
source="https://gitlab.com/postmarketos/obex-capabilities/-/archive/$pkgver/obex-capabilities-$pkgver.tar.gz
	org.bluez.obex.service
	"

build() {
	python3 setup.py build
}

check() {
	pytest
}

package() {
	python3 setup.py install --prefix=/usr --root="$pkgdir"
}

_obexd() {
	install_if="$pkgname=$pkgver-r$pkgrel bluez-obexd"
	replaces="bluez-obexd"
	mkdir -p "$subpkgdir"

	# Add script with --capability= argument
	install -Dm644 "$srcdir"/org.bluez.obex.service \
		-t "$subpkgdir"/usr/share/dbus-1/services
}

sha512sums="
a6a63ce4dd3c4d129f1ccdabe3e2eb03b8d9a43f71b8afa29a0f46d6ccbc2685cb33d895ad0146b9c021d8f68730bc21f8b804d89db6660980eae8a7ec3a1ce2  obex-capabilities-0.2.1.tar.gz
6b53966522df8405f4cfb794874dc2f126abded53fddf1fd559126afc039faab9d51421852dba8abf53700fd79388db16897d590151fe6a43f97676f868d08ee  org.bluez.obex.service
"
